NOTE: PROCEDURE PRINTTO used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

3    
4    DM "log; clear; ";
5    DM 'odsresults; clear';
6    
7    %global projectrootdirectory;
8    %let projectrootdirectory=C:/Users/hpham13/Projects/mf_activism/empirical;
9    
10   *Creates your local Libraries;
11   libname rawdata "&projectrootdirectory./0_input/original";
NOTE: Libref RAWDATA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Projects\mf_activism\empirical\0_input\original
12   libname save    "&projectrootdirectory./1_code/final_package_acceptance";
NOTE: Libref SAVE was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: 
      C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance
13   
14   %global datadirectory;
15   %let datadirectory=C:/Users/hpham13/Data;
16   
17   /* Define the local library */
18   libname data "C:/Users/hpham13/Projects/mutualfund/empirical/0_inputs/mfdb/Data/Original";
NOTE: Libref DATA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Projects\mutualfund\empirical\0_inputs\mfdb\Data\Original
19   
20   libname lnk "&datadirectory./Linking_tables/";
NOTE: Libref LNK was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\Linking_tables
21   libname ceo "&datadirectory./ceo/";
NOTE: Libref CEO was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\ceo
22   libname activism "&datadirectory./activism/" ;
NOTE: Libref ACTIVISM was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\activism
23   libname comp "&datadirectory./compustat/fundq/";
NOTE: Libref COMP was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\compustat\fundq
24   libname crsp "&datadirectory./crsp/";
NOTE: Libref CRSP was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\crsp
25   libname tr "&datadirectory./ThomsonReuters/s12";
NOTE: Libref TR was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\ThomsonReuters\s12
25 !                                                   * my thompson reuter folder;
26   libname lnk "&datadirectory./Linking_tables";
NOTE: Libref LNK was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\Linking_tables
27   libname mfl "&datadirectory./Linking_tables/mflink2_20230828";
NOTE: Libref MFL was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Data\Linking_tables\mflink2_20230828
28   
29   * include some macros;
30   %include "&datadirectory./utils/do_over.sas";
337  %include "&datadirectory./utils/ff48.sas";
409  %include "&datadirectory./utils/ff49.sas";
482  %include "&datadirectory./utils/ff12.sas";
521  %include "&datadirectory./utils/winsorize.sas";
609   %include "&datadirectory./utils/lags.sas";
788   
789   
790   /* ******************************************************************************** */
791   /* PART 1:  Compute MF holdings "Adjusted Shares Held" from S12 and CRSP     ****** */
792   /* ******************************************************************************** */
793   /* Step 1.1. Specifying Options */
794   %let begdate = 01MAR1995;
795   %let enddate = 31DEC2021;
796   
797   /* Step 1.2. Get CRSP Prices, Returns, and Adjustment Factors from MSF Dataset */
798   /* and Since Thomson S12 is Quarterly (FDATE & RDATE), we align CRSP month-end dates */
799   data Price;
800       format QDATE date9. ;
801       set crsp.msf (keep=permno date cfacpr cfacshr shrout prc ret);
NOTE: Data file CRSP.MSF.DATA is in a format that is native to another host, or the file 
      encoding does not match the session encoding. Cross Environment Data Access will be used, 
      which might require additional CPU resources and might reduce performance.
802       by permno date;
803       where date between "&begdate"d and "&enddate"d;
804       QDATE = INTNX('QTR',date,0,'E');
805       DATE = INTNX('MONTH',date,0,'E');
806       TSO=shrout*cfacshr*1000;
807       P  = abs(prc)/cfacpr;
808       P_1= lag(P); if first.permno then P_1=.;
809       ME = P*TSO/1000000;
810       label TSO = "Total Shares Outstanding, Adjusted";
811       label P = "Price at t Period End, Adjusted";
812       label P_1 = "Price at (t-1), Adjusted";
813       label ME = "Market Capitalization, x$1m";
814       if TSO>0; format TSO comma12.0 ret percentn8.2 prc: dollar12.3;
815       drop prc cfacpr shrout;
816   run;

NOTE: Division by zero detected at line 807 column 18.
QDATE=31DEC2011 PERMNO=13030 DATE=20111031 PRC=$17.330 RET=C SHROUT=200 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=164928
NOTE: Division by zero detected at line 807 column 18.
QDATE=31DEC2011 PERMNO=13030 DATE=20111130 PRC=$17.360 RET=0.17% SHROUT=300 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=164929
NOTE: Division by zero detected at line 807 column 18.
QDATE=31DEC2011 PERMNO=13030 DATE=20111231 PRC=$12.160 RET=-29.95% SHROUT=800 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=164930
NOTE: Division by zero detected at line 807 column 18.
QDATE=31MAR2012 PERMNO=13030 DATE=20120131 PRC=$6.830 RET=-43.83% SHROUT=2500 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=164931
NOTE: Division by zero detected at line 807 column 18.
QDATE=31MAR2012 PERMNO=13030 DATE=20120229 PRC=$5.490 RET=-19.62% SHROUT=19098 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=164932
NOTE: Division by zero detected at line 807 column 18.
QDATE=30SEP2004 PERMNO=90298 DATE=20040731 PRC=$11.450 RET=C SHROUT=18279 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059434
NOTE: Division by zero detected at line 807 column 18.
QDATE=30SEP2004 PERMNO=90298 DATE=20040831 PRC=$11.720 RET=2.36% SHROUT=18279 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059435
NOTE: Division by zero detected at line 807 column 18.
QDATE=30SEP2004 PERMNO=90298 DATE=20040930 PRC=$15.990 RET=36.43% SHROUT=18279 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059436
NOTE: Division by zero detected at line 807 column 18.
QDATE=31DEC2004 PERMNO=90298 DATE=20041031 PRC=$17.100 RET=6.94% SHROUT=18279 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059437
NOTE: Division by zero detected at line 807 column 18.
QDATE=31DEC2004 PERMNO=90298 DATE=20041130 PRC=$22.550 RET=31.87% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059438
NOTE: Division by zero detected at line 807 column 18.
QDATE=31DEC2004 PERMNO=90298 DATE=20041231 PRC=$16.250 RET=-27.01% SHROUT=27831 CFACPR=0
CFACSHR=0 FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1
_N_=2059439
NOTE: Division by zero detected at line 807 column 18.
QDATE=31MAR2005 PERMNO=90298 DATE=20050131 PRC=$16.890 RET=3.94% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059440
NOTE: Division by zero detected at line 807 column 18.
QDATE=31MAR2005 PERMNO=90298 DATE=20050228 PRC=$21.670 RET=28.30% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059441
NOTE: Division by zero detected at line 807 column 18.
QDATE=31MAR2005 PERMNO=90298 DATE=20050331 PRC=$18.550 RET=-13.43% SHROUT=27831 CFACPR=0
CFACSHR=0 FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1
_N_=2059442
NOTE: Division by zero detected at line 807 column 18.
QDATE=30JUN2005 PERMNO=90298 DATE=20050430 PRC=$15.600 RET=-15.90% SHROUT=27831 CFACPR=0
CFACSHR=0 FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1
_N_=2059443
NOTE: Division by zero detected at line 807 column 18.
QDATE=30JUN2005 PERMNO=90298 DATE=20050531 PRC=$15.940 RET=2.18% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059444
NOTE: Division by zero detected at line 807 column 18.
QDATE=30JUN2005 PERMNO=90298 DATE=20050630 PRC=$15.870 RET=-0.44% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059445
NOTE: Division by zero detected at line 807 column 18.
QDATE=30SEP2005 PERMNO=90298 DATE=20050731 PRC=$15.370 RET=-0.25% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=0 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059446
NOTE: Division by zero detected at line 807 column 18.
QDATE=30SEP2005 PERMNO=90298 DATE=20050731 PRC=$15.370 RET=-0.25% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=0 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059447
NOTE: Division by zero detected at line 807 column 18.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.
QDATE=30SEP2005 PERMNO=90298 DATE=20050831 PRC=$15.410 RET=0.26% SHROUT=27831 CFACPR=0 CFACSHR=0
FIRST.PERMNO=0 LAST.PERMNO=0 FIRST.DATE=1 LAST.DATE=1 TSO=0 P=. P_1=. ME=. _ERROR_=1 _N_=2059448
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      16861 at 806:15   64195 at 807:10   64195 at 807:18   64851 at 809:11   
NOTE: Mathematical operations could not be performed at the following places. The results of the 
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      656 at 807:18   
NOTE: There were 2373587 observations read from the data set CRSP.MSF.
      WHERE (date>='01MAR1995'D and date<='31DEC2021'D);
NOTE: The data set WORK.PRICE has 2340645 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           7.95 seconds
      cpu time            3.34 seconds
      

817   
818   /* Keep Last Monthly Observation for Each quarter */
819   data Price;
820       set Price;
821       by permno qdate date;
822       if last.qdate;
823   run;

NOTE: There were 2340645 observations read from the data set WORK.PRICE.
NOTE: The data set WORK.PRICE has 788968 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.16 seconds
      cpu time            0.12 seconds
      

824   
825   /* Step 1.3. Get report and vintage dates from Thomson-Reuters Mutual Fund Holdings     */
826   /* Exclude Non-Equity Funds from Holdings data that is reported as of Fiscal Quarter End */
827   /* First, Keep First Vintage with Holdings Data for Each RDATE-FUNDNO */
828   proc sql;
829       create table First_Vint
830       as select distinct intnx("month",rdate,0,"E") as rdate format date9., fdate, fundno
831       from tr.s12type1
832       where ("&begdate"d <= rdate <="&enddate"d and ioc not in (1,5,6,7))
833       group by fundno, intnx("month",rdate,0,"E")
834       having fdate=min(fdate) and max(rdate)=rdate
835       order by fundno, rdate desc;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.FIRST_VINT created, with 1552309 rows and 3 columns.

836   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.28 seconds
      cpu time            1.78 seconds
      

837   
838   /* Until 2003, funds were only required to disclose their holdings semi-annually        */
839   /* Approximately 60% of funds additionally report quarterly holdings                    */
840   /* Use 6-Months as cut-off for portfolio holding period if the gap btw rdates is large  */
841   data First_Vint; set First_Vint;
842       by fundno descending rdate; format nrdate date9.;
843       nrdate = lag(rdate); if first.fundno then nrdate = intnx("month",rdate,6,"E");
844       nrdate = min(nrdate,intnx("month",rdate,6,"E"));
845   run;

NOTE: There were 1552309 observations read from the data set WORK.FIRST_VINT.
NOTE: The data set WORK.FIRST_VINT has 1552309 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.27 seconds
      cpu time            0.28 seconds
      

846   proc sort data=First_Vint nodupkey; by fundno fdate; run;

NOTE: There were 1552309 observations read from the data set WORK.FIRST_VINT.
NOTE: 14 observations with duplicate key values were deleted.
NOTE: The data set WORK.FIRST_VINT has 1552295 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.09 seconds
      cpu time            0.29 seconds
      

847   
848   /* Step 1.4. Add WFICN portfolio identifiers from MFLINKS */
849   proc sql;
850       create table First_Vint
851       as select b.wficn, a.*
852       from First_Vint as a, mfl.mflink2 as b
853       where a.fundno=b.fundno and a.fdate=b.fdate and not missing(b.wficn);
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.FIRST_VINT created, with 419694 rows and 5 columns.

854   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.58 seconds
      cpu time            0.64 seconds
      

855   proc sort data=First_Vint nodupkey; by wficn rdate; run;

NOTE: There were 419694 observations read from the data set WORK.FIRST_VINT.
NOTE: 122 observations with duplicate key values were deleted.
NOTE: The data set WORK.FIRST_VINT has 419572 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.09 seconds
      

856   
857   /* Add Total Number of S12 Filers During Each Quarter (NumInst) */
858   proc sql undo_policy=none;
859       create table First_Vint
860       as select distinct *, count(fundno) as NumInst
861       from First_Vint
862       group by rdate
863       order by fdate, fundno;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.FIRST_VINT created, with 419572 rows and 6 columns.

864   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.14 seconds
      cpu time            0.21 seconds
      

865   
866   
867   /* Step 1.5. Extract Holdings data by Merging TR-MF S12type1 and S12type3 Sets  */
868   proc sql;
869       /* quarterly data */
870       create view Holdings
871       as select a.rdate,a.nrdate,a.fdate,a.wficn,a.fundno,a.NumInst,b.cusip,b.shares
872       from First_Vint as a, tr.s12type3 as b
873       where a.fdate=b.fdate and a.fundno=b.fundno;
NOTE: SQL view WORK.HOLDINGS has been defined.
874   
875       /* monthly data */
876       create view Holdings1
877       as select a.rdate,a.nrdate,a.fdate,a.wficn,a.fundno,a.NumInst,b.permno,a.shares
878       from Holdings as a, (select distinct ncusip, permno from data.msenames
879                      where not missing(ncusip)) as b
880       where a.cusip=b.ncusip;
NOTE: SQL view WORK.HOLDINGS1 has been defined.
881   
882       /* quarterly data @ stock level */
883       create table Holdings2
884       as select b.date, a.rdate,a.nrdate,a.wficn,a.fundno,a.permno,a.NumInst,
885           a.shares*b.cfacshr as shares_adj label = "Adjusted Shares Held"
886       from Holdings1 as a, price as b
887       where a.permno=b.permno and a.fdate=b.qdate;
NOTE: Table WORK.HOLDINGS2 created, with 43478321 rows and 8 columns.

888   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           35.47 seconds
      cpu time            35.28 seconds
      

889   
890   /* Sanity Checks for Duplicates */
891   proc sort
892      data=Holdings2
893      out=MF_Holdings nodupkey;
894      by wficn rdate permno;
895   run;

NOTE: There were 43478321 observations read from the data set WORK.HOLDINGS2.
NOTE: 23 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_HOLDINGS has 43478298 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           4.33 seconds
      cpu time            13.01 seconds
      

896   
897   
898   
899   
900   /* ******************************************************************************** */
901   /* Part 2:   Make a List of Domestic all-equity funds using CRSP MFDB   *********** */
902   /* ******************************************************************************** */
903   /* Extract CRSP Mutual Funds Performance and Characteristics */
904   /* Merge fraction of portfolio in equity assets with the objective code data */
905   proc sql;
906   create table Fund_Style
907   as select a.crsp_fundno, a.si_obj_cd, a.wbrger_obj_cd, a.lipper_obj_cd, a.lipper_obj_name,
908             a.lipper_asset_cd, a.policy, a.lipper_class, a.crsp_obj_cd, b.avrcs
909   from crsp.fund_style a left join (select distinct crsp_fundno, sum(per_com)/count(per_com)
909 ! as avrcs
910                                      from data.fund_summary2 group by crsp_fundno) b
911   on a.crsp_fundno=b.crsp_fundno;
NOTE: Table WORK.FUND_STYLE created, with 186445 rows and 10 columns.

912   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.58 seconds
      cpu time            0.78 seconds
      

913   
914   /* Step 2.2. Sample Selection, focus on Domestic Equity Mutual Funds */
915   /* for which the holdings data are the most complete and reliable */
916   data Equity_Funds; set Fund_Style;
917   if not missing (Lipper_Class) and lipper_class not in
917 ! ('EIEI','G','LCCE','LCGE','LCVE','MCCE',
918      'MCGE','MCVE','MLCE','MLGE','MLVE','SCCE','SCGE','SCVE') then delete;
919   else if missing(Lipper_Class) then do;
920    if  not missing(si_obj_cd) and si_obj_cd not in ('AGG','GMC','GRI','GRO','ING','SCG') then
920 !  delete;
921    else if missing(si_obj_cd) then do;
922     if not missing (wbrger_obj_cd) and wbrger_obj_cd not in
922 ! ('G','G-I','AGG','GCI','GRI','GRO','LTG',
923        'MCG','SCG') then delete;
924     else if missing(wbrger_obj_cd) then do;
925       if not missing(policy) and policy ne 'CS' then delete;
926        else if not missing(policy) and avrcs<80 then delete;
927   end; end; end;
928   keep crsp_fundno lipper_obj_cd lipper_obj_name crsp_obj_cd;
929   run;

NOTE: There were 186445 observations read from the data set WORK.FUND_STYLE.
NOTE: The data set WORK.EQUITY_FUNDS has 72495 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

930   
931   data names; set crsp.fund_names (where=(fund_name ne ''));
932       by crsp_fundno;
933       if last.crsp_fundno;
934       keep crsp_fundno fund_name index_fund_flag;
935   run;

NOTE: There were 599342 observations read from the data set CRSP.FUND_NAMES.
      WHERE fund_name not = ' ';
NOTE: The data set WORK.NAMES has 71033 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.16 seconds
      cpu time            0.14 seconds
      

936   
937   /* identify index and target date funds and drop them from the sample */
938   data funds3; merge Equity_Funds (in=in1) names;
939       by crsp_fundno;
940       if in1;
941   run;

NOTE: There were 72495 observations read from the data set WORK.EQUITY_FUNDS.
NOTE: There were 71033 observations read from the data set WORK.NAMES.
NOTE: The data set WORK.FUNDS3 has 72495 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

942   
943   proc sql;
944       create table funds4 (drop=index_fund_flag) as
945       select * from funds3
946       group by crsp_fundno
947       having count(index_fund_flag) = 0;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.FUNDS4 created, with 68402 rows and 5 columns.

948   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.04 seconds
      

949   
950   
951   data funds4; set funds4;
952         format namex $140.;
953         namex = lowcase(fund_name);
954         if max(index(namex,'index'), index(namex,'s&p')) = 0;
955         if max(index(namex,'idx'), index(namex,'dfa'), index(namex,'program')) = 0;
956         if max(indexw(namex,'etf'),index(namex,'exchange traded'),
957               index(namex,'exchange-traded')) = 0;
958         if max(index(namex,'target'),index(namex,'2005'),index(namex,'2005'),
959               index(namex,'2010'),index(namex,'2015'),index(namex,'2020'),index(namex,'2025')
959 ! ,
960               index(namex,'2030'),index(namex,'2035'),index(namex,'2040'),
961               index(namex,'2045'),index(namex,'2050'),index(namex,'2055')) = 0;
962         drop namex fund_name;
963   run;

NOTE: There were 68402 observations read from the data set WORK.FUNDS4.
NOTE: The data set WORK.FUNDS4 has 67225 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.07 seconds
      

964   
965   data funds4; set funds4;
966       if missing (lipper_obj_cd) then lipper_obj_cd = "OEQ";
967       if lipper_obj_cd = "OEQ" then lipper_obj_name = "Other Equity Funds";
968   run;

NOTE: There were 67225 observations read from the data set WORK.FUNDS4.
NOTE: The data set WORK.FUNDS4 has 67225 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

969   
970   data funds4; set funds4;
971       crsp_obj_cd_2 = substr(crsp_obj_cd, 1, 2);
972       new_var = tranwrd(lipper_obj_name, "&", "AND");
973       new_varx = upcase(new_var);
974       drop lipper_obj_name new_var ;
975       rename new_varx = lipper_obj_name;
976   run;

NOTE: There were 67225 observations read from the data set WORK.FUNDS4.
NOTE: The data set WORK.FUNDS4 has 67225 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds
      

977   
978   * select "ED" mutual funds;
979   data funds5; set funds4;
980       if crsp_obj_cd_2 = "ED" ;
981   run;

NOTE: There were 67225 observations read from the data set WORK.FUNDS4.
NOTE: The data set WORK.FUNDS5 has 57904 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

982   
983   * Get Index funds;
984   proc sql;
985       create table funds6 (drop=index_fund_flag) as
986       select * from funds3
987       group by crsp_fundno
988       having count(index_fund_flag) > 0;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.FUNDS6 created, with 4093 rows and 5 columns.

989   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.04 seconds
      cpu time            0.06 seconds
      

990   
991   * Make the list of index funds;
992   proc sql;
993       create table MF_Port (where=(wficn ne .)) as
994       select distinct b.wficn, a.crsp_fundno
995       from funds6 as a left join mfl.mflink1 as b
996         on a.crsp_fundno=b.crsp_fundno
997       group by b.wficn
998       order by wficn, crsp_fundno;
NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional 
      HAVING clause of the associated table-expression referenced a summary function.
NOTE: Table WORK.MF_PORT created, with 1684 rows and 2 columns.

999   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1000  
1001  proc sort data=MF_Port; by wficn; run;

NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1002  
1003  
1004  
1005  /* ******************************************************************************** */
1006  /* Part 3:   Merge the List of Domestic all-equity IDX funds and Holdings   ******* */
1007  /* ******************************************************************************** */
1008  proc sort data=MF_Port; by wficn crsp_fundno; run;

NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1009  data MF_merged;
1010      merge MF_Holdings(in=a) MF_Port(in=b);
1011      by wficn ;
1012      if b;
1013  run;

NOTE: MERGE statement has more than one data set with repeats of BY values.
NOTE: There were 43478298 observations read from the data set WORK.MF_HOLDINGS.
NOTE: There were 1684 observations read from the data set WORK.MF_PORT.
NOTE: The data set WORK.MF_MERGED has 14518207 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           2.36 seconds
      cpu time            2.34 seconds
      

1014  
1015  %let md_rdate = (year(rdate)*12 + month(rdate) - 1925*12 - 11);
1016  %let qd_rdate = (year(rdate)*4  + qtr(rdate)   - 1925*4);
1017  data MF_merged;
1018      set MF_merged;
1019      md = &md_rdate;
1020      qd = &qd_rdate;
1021  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      110 at 1:3    110 at 1:14   110 at 1:3    110 at 1:14   
NOTE: There were 14518207 observations read from the data set WORK.MF_MERGED.
NOTE: The data set WORK.MF_MERGED has 14518207 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           1.87 seconds
      cpu time            1.82 seconds
      

1022  
1023  proc sort
1024      data=MF_merged
1025      out=MF_merged nodupkey;
1026      by wficn rdate permno ;
1027  run;

NOTE: There were 14518207 observations read from the data set WORK.MF_MERGED.
NOTE: 37 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED has 14518170 observations and 11 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           1.52 seconds
      cpu time            3.98 seconds
      

1028  
1029  
1030  /* ******************************************************************************** */
1031  /* Part 4:   Merge holdings with Fund characteristics ***************************** */
1032  /* ******************************************************************************** */
1033  /* sort MF_Port: list of crsp domestic equity funds (include voluntarily disclosed funds)*/
1034  proc sort data=MF_Port; by crsp_fundno; run;

NOTE: There were 1684 observations read from the data set WORK.MF_PORT.
NOTE: The data set WORK.MF_PORT has 1684 observations and 2 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1035  
1036  /* Merge list of domestic quity funds with TNA data */
1037  data returns1; merge MF_Port (in=in1) data.monthly_tna_ret_nav (drop=mnav);  * data is
1037! updated to 2020;
1038        by crsp_fundno;
1039        if in1 = 1;
1040        if wficn ne .;
1041        if mtna < 0 then mtna = .;
1042        mtna = mtna + 0;
1043        mret = mret + 0;
1044        retain tna;
1045        if first.crsp_fundno or mtna ne . then tna = mtna;
1046        rename caldt=date;
1047        drop mtna;
1048  run;

NOTE: MERGE statement has more than one data set with repeats of BY values.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      6808 at 1042:19   9200 at 1043:19   
NOTE: There were 1684 observations read from the data set WORK.MF_PORT.
NOTE: There were 8497746 observations read from the data set DATA.MONTHLY_TNA_RET_NAV.
NOTE: The data set WORK.RETURNS1 has 227511 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.40 seconds
      cpu time            0.37 seconds
      

1049  /* get expense ratio data required to get gross returns */
1050  proc sql;
1051        create table returns2 as select a.*, b.exp_ratio
1052        from returns1 (rename=(tna=mtna)) as a left join data.fund_fees as b
1053        on a.crsp_fundno=b.crsp_fundno and date between b.begdt and b.enddt
1054        order by crsp_fundno, date;
NOTE: Table WORK.RETURNS2 created, with 227607 rows and 6 columns.

1055  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.24 seconds
      cpu time            0.28 seconds
      

1056  /* compute gross returns */
1057  data returns2; set returns2;
1058        by crsp_fundno date;
1059        if exp_ratio = -99 then exp_ratio=.;
1060        weight = lag(mtna);
1061        if first.crsp_fundno then weight = mtna;
1062        rret=sum(mret,exp_ratio/12);
1063        *drop exp_ratio;
1064  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      7819 at 1062:12    48486 at 1062:30   
NOTE: There were 227607 observations read from the data set WORK.RETURNS2.
NOTE: The data set WORK.RETURNS2 has 227607 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds
      

1065  /* aggregate multiple share classes */
1066  proc sort data = returns2; by wficn date; run;

NOTE: There were 227607 observations read from the data set WORK.RETURNS2.
NOTE: The data set WORK.RETURNS2 has 227607 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds
      

1067  
1068  data multiclass1 oneclass; set returns2;
1069        by wficn date;
1070        if first.date=0 or last.date=0 then output multiclass1;
1071        else output oneclass;
1072  run;

NOTE: There were 227607 observations read from the data set WORK.RETURNS2.
NOTE: The data set WORK.MULTICLASS1 has 131353 observations and 8 variables.
NOTE: The data set WORK.ONECLASS has 96254 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1073  
1074  /* aggregate returns to the wficn-month level */
1075  proc sql;
1076        create table multiclass2
1077        as select wficn, date, sum(mret*weight)/sum(weight) as mret,
1078        sum(mtna) as mtna, sum(rret*weight)/sum(weight) as rret
1079        from multiclass1 group by wficn, date;
NOTE: Table WORK.MULTICLASS2 created, with 45937 rows and 5 columns.

1080  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.07 seconds
      

1081  
1082  /* create some local date vars for merging */
1083  %let md = (year(date)*12 + month(date) - 1925*12 - 11);
1084  %let qd = (year(date)*4  + qtr(date)   - 1925*4);
1085  
1086  data returns; set oneclass (drop=weight) multiclass2;
1087        md = &md;
1088        qd = &qd;
1089        rename mret=ret mtna=tna;
1090        *drop crsp_fundno ;
1091  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      28 at 1:3    28 at 1:13   28 at 1:3    28 at 1:13   
NOTE: There were 96254 observations read from the data set WORK.ONECLASS.
NOTE: There were 45937 observations read from the data set WORK.MULTICLASS2.
NOTE: The data set WORK.RETURNS has 142191 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1092  proc sort data = returns nodupkey; by wficn md; run;

NOTE: There were 142191 observations read from the data set WORK.RETURNS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.RETURNS has 142191 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.07 seconds
      

1093  
1094  * house cleaning;
1095  proc datasets nowarn nolist nodetails;
NOTE: Writing HTML Body file: sashtml.htm
1096        delete multiclass1 multiclass2 oneclass returns1 returns2;
1097  quit;

NOTE: Deleting WORK.MULTICLASS1 (memtype=DATA).
NOTE: Deleting WORK.MULTICLASS2 (memtype=DATA).
NOTE: Deleting WORK.ONECLASS (memtype=DATA).
NOTE: Deleting WORK.RETURNS1 (memtype=DATA).
NOTE: Deleting WORK.RETURNS2 (memtype=DATA).
NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.30 seconds
      cpu time            0.14 seconds
      

1098  
1099  data returns;
1100      set returns;
1101      logtna = log(tna);
1102  run;

NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=107204 crsp_fundno=. date=20080430 ret=0.147973 tna=0 exp_ratio=. rret=0.149242567 md=989
qd=334 logtna=. _ERROR_=1 _N_=27140
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=107204 crsp_fundno=. date=20080530 ret=. tna=0 exp_ratio=. rret=. md=990 qd=334 logtna=.
_ERROR_=1 _N_=27141
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=107204 crsp_fundno=. date=20080630 ret=. tna=0 exp_ratio=. rret=. md=991 qd=334 logtna=.
_ERROR_=1 _N_=27142
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=107204 crsp_fundno=. date=20080731 ret=. tna=0 exp_ratio=. rret=. md=992 qd=335 logtna=.
_ERROR_=1 _N_=27143
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=107204 crsp_fundno=. date=20080829 ret=. tna=0 exp_ratio=. rret=. md=993 qd=335 logtna=.
_ERROR_=1 _N_=27144
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=107204 crsp_fundno=. date=20080930 ret=. tna=0 exp_ratio=. rret=. md=994 qd=335 logtna=.
_ERROR_=1 _N_=27145
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108163 crsp_fundno=. date=20080430 ret=0.094631 tna=0 exp_ratio=. rret=0.0959375458 md=989
qd=334 logtna=. _ERROR_=1 _N_=29608
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108163 crsp_fundno=. date=20080530 ret=. tna=0 exp_ratio=. rret=. md=990 qd=334 logtna=.
_ERROR_=1 _N_=29609
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108163 crsp_fundno=. date=20080630 ret=. tna=0 exp_ratio=. rret=. md=991 qd=334 logtna=.
_ERROR_=1 _N_=29610
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108163 crsp_fundno=. date=20080731 ret=. tna=0 exp_ratio=. rret=. md=992 qd=335 logtna=.
_ERROR_=1 _N_=29611
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108163 crsp_fundno=. date=20080829 ret=. tna=0 exp_ratio=. rret=. md=993 qd=335 logtna=.
_ERROR_=1 _N_=29612
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108163 crsp_fundno=. date=20080930 ret=. tna=0 exp_ratio=. rret=. md=994 qd=335 logtna=.
_ERROR_=1 _N_=29613
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108164 crsp_fundno=. date=20080430 ret=0.081772 tna=0 exp_ratio=. rret=0.0830771225 md=989
qd=334 logtna=. _ERROR_=1 _N_=29866
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108164 crsp_fundno=. date=20080530 ret=. tna=0 exp_ratio=. rret=. md=990 qd=334 logtna=.
_ERROR_=1 _N_=29867
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108164 crsp_fundno=. date=20080630 ret=. tna=0 exp_ratio=. rret=. md=991 qd=334 logtna=.
_ERROR_=1 _N_=29868
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108164 crsp_fundno=. date=20080731 ret=. tna=0 exp_ratio=. rret=. md=992 qd=335 logtna=.
_ERROR_=1 _N_=29869
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108164 crsp_fundno=. date=20080829 ret=. tna=0 exp_ratio=. rret=. md=993 qd=335 logtna=.
_ERROR_=1 _N_=29870
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108164 crsp_fundno=. date=20080930 ret=. tna=0 exp_ratio=. rret=. md=994 qd=335 logtna=.
_ERROR_=1 _N_=29871
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
wficn=108944 crsp_fundno=. date=20080430 ret=0.047717 tna=0 exp_ratio=. rret=0.0492017828 md=989
qd=334 logtna=. _ERROR_=1 _N_=32459
NOTE: Invalid argument to function LOG(0) at line 1101 column 14.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.
wficn=108944 crsp_fundno=. date=20080530 ret=. tna=0 exp_ratio=. rret=. md=990 qd=334 logtna=.
_ERROR_=1 _N_=32460
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      574 at 1101:14   
NOTE: Mathematical operations could not be performed at the following places. The results of the 
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      144 at 1101:14   
NOTE: There were 142191 observations read from the data set WORK.RETURNS.
NOTE: The data set WORK.RETURNS has 142191 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1103  
1104  %let md = (year(caldt)*12 + month(caldt) - 1925*12 - 11);
1105  %let qd = (year(caldt)*4  + qtr(caldt)   - 1925*4);
1106  data fundchars; merge MF_Port (in=in1) data.fund_summary2;
1107      by crsp_fundno;
1108      md = &md;
1109      qd = &qd;
1110      fundage = log(year(caldt) - year(first_offer_dt));
1111      per_cash2 = sum(per_cash, per_muni, per_govt )/100;
1112      per_cash = per_cash/100;
1113      if wficn ne .;
1114      rename caldt=date;
1115      keep crsp_fundno wficn caldt date mgmt_fee turn_ratio first_offer_dt
1116      mgmt_name mgmt_cd fundage md qd per_cash per_muni per_govt per_cash2 nav_latest ;
1117  run;

WARNING: The variable date in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000001 summary_period2=A caldt=19971231 summary_period=A
nav_latest=15.3000000 nav_latest_dt=19971231 tna_latest=81.000 tna_latest_dt=19971231
yield=0.0620065359 div_ytd=0.94870000000 cap_gains_ytd=0.02000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19980630 per_com=0
per_pref=0 per_conv=0 per_corp=88.13 per_muni=0 per_govt=3.34 per_oth=0.02 per_cash=0.0851
per_bond=0 per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=9.8 maturity_dt=19980630
cusip8=  crsp_portno=. crsp_cl_grp=. fund_name=AARP Income Tr:Bond for Income ticker=AABIX
ncusip=  mgmt_name=SCUDDER STEVENS & CLARK mgmt_cd=  mgr_name=Stephen A Wohler mgr_dt=19970201
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19970201 end_dt=20000731 dead_flag=Y
merge_fundno=008441 actual_12b1=0.000000 max_12b1=. mgmt_fee=-0.282000 exp_ratio=0.001900
turn_ratio=1.310000 fiscal_yearend=19980930 crsp_obj_cd=ICQM si_obj_cd=CMQ accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=865
qd=292 fundage=. per_cash2=0.1185 _ERROR_=1 _N_=1
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000002 summary_period2=A caldt=19971231 summary_period=A
nav_latest=17.0900000 nav_latest_dt=19971231 tna_latest=72.000 tna_latest_dt=19971231
yield=0.0187244002 div_ytd=0.32000000000 cap_gains_ytd=0.10000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19980630 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=98.55 per_cash=0.0145 per_bond=0
per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=.
crsp_cl_grp=. fund_name=AARP Mngd Inv Port Tr:Diversified Growth ticker=AADGX ncusip= 
mgmt_name=SCUDDER STEVENS & CLARK mgmt_cd=  mgr_name=Philip S Fortuna mgr_dt=19970201 adv_name= 
open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N et_flag= 
delist_cd=  header=0 first_offer_dt=19970203 end_dt=20000831 dead_flag=Y merge_fundno=008425
actual_12b1=0.000000 max_12b1=. mgmt_fee=0.000000 exp_ratio=0.000000 turn_ratio=0.060000
fiscal_yearend=19980930 crsp_obj_cd=EDYG si_obj_cd=GRO accrual_fund=  sales_restrict= 
wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name= 
lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=865 qd=292 fundage=.
per_cash2=0.0145 _ERROR_=1 _N_=10
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000003 summary_period2=A caldt=19931231 summary_period=A
nav_latest=10.4200000 nav_latest_dt=19931231 tna_latest=0.013 tna_latest_dt=19931231
yield=0.0574856046 div_ytd=0.59900000000 cap_gains_ytd=0.40580000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19931231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=Rembrandt Funds:Global Fixed Income Fund/Inv ticker=  ncusip= 
mgmt_name=LaSalle Street Capital Mgmt Ltd mgmt_cd=  mgr_name=Roy Scheepe mgr_dt=19930201
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19930426 end_dt=20000831 dead_flag=Y merge_fundno=.
actual_12b1=0.002500 max_12b1=. mgmt_fee=. exp_ratio=0.015600 turn_ratio=1.460000
fiscal_yearend=. crsp_obj_cd=IF si_obj_cd=BGN accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=817 qd=276 fundage=. per_cash2=0
_ERROR_=1 _N_=19
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000004 summary_period2=A caldt=19971231 summary_period=A
nav_latest=16.4600000 nav_latest_dt=19971231 tna_latest=23.800 tna_latest_dt=19971231
yield=0.0066828676 div_ytd=0.11000000000 cap_gains_ytd=0.15000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19980630
per_com=91.3 per_pref=1.1 per_conv=1.4 per_corp=0 per_muni=0 per_govt=0 per_oth=0.3
per_cash=0.059 per_bond=0 per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=0.0
maturity_dt=19980630 cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=AARP Growth Tr:International Growth & Income ticker=AAISX ncusip= 
mgmt_name=SCUDDER STEVENS & CLARK mgmt_cd=  mgr_name=Sheridan Reilly mgr_dt=19970201 adv_name= 
open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N et_flag= 
delist_cd=  header=0 first_offer_dt=19970203 end_dt=20000731 dead_flag=Y merge_fundno=008513
actual_12b1=0.000000 max_12b1=. mgmt_fee=0.222000 exp_ratio=0.017500 turn_ratio=0.750000
fiscal_yearend=19980930 crsp_obj_cd=EFYT si_obj_cd=EIT accrual_fund=  sales_restrict= 
wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name= 
lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=865 qd=292 fundage=.
per_cash2=0.059 _ERROR_=1 _N_=32
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000008 summary_period2=A caldt=19901231 summary_period=A
nav_latest=13.2700000 nav_latest_dt=19901231 tna_latest=0.160 tna_latest_dt=19901231
yield=0.0021929164 div_ytd=0.02910000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19901231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=EQUITABLE BALANCED FUND/A ticker=  ncusip=  mgmt_name=  mgmt_cd=  mgr_name= 
mgr_dt=19900901 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag= 
vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19900101 end_dt=19990129 dead_flag=Y
merge_fundno=004089 actual_12b1=. max_12b1=. mgmt_fee=. exp_ratio=0.000000 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=781 qd=264 fundage=. per_cash2=0
_ERROR_=1 _N_=54
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000009 summary_period2=A caldt=19871231 summary_period=A
nav_latest=10.7000000 nav_latest_dt=19871231 tna_latest=1.980 tna_latest_dt=19871231
yield=0.0002336449 div_ytd=0.00250000000 cap_gains_ytd=0.05510000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19871231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=Equitable Balanced B ticker=  ncusip=  mgmt_name=  mgmt_cd=  mgr_name=  mgr_dt=19871001
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19870101 end_dt=19990129 dead_flag=Y
merge_fundno=004090 actual_12b1=. max_12b1=. mgmt_fee=. exp_ratio=0.000000 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=745 qd=252 fundage=. per_cash2=0
_ERROR_=1 _N_=64
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000010 summary_period2=A caldt=19931231 summary_period=A
nav_latest=15.2500000 nav_latest_dt=19931231 tna_latest=0.971 tna_latest_dt=19931231
yield=0.008852459 div_ytd=0.13500000000 cap_gains_ytd=1.17000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19940630
per_com=54.5 per_pref=0 per_conv=2.7 per_corp=4.7 per_muni=0 per_govt=13.1 per_oth=0
per_cash=0.25 per_bond=0 per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=0.0
maturity_dt=19940630 cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=Alliance Port:Strategic Balanced Fund/C ticker=  ncusip= 
mgmt_name=ALLIANCE CAPITAL MANAGEMENT CORP. mgmt_cd=  mgr_name=Judith Taylor mgr_dt=19930801
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19930101 end_dt=19990129 dead_flag=Y
merge_fundno=004091 actual_12b1=0.010000 max_12b1=. mgmt_fee=. exp_ratio=0.021000 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=M si_obj_cd=BAL accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=817 qd=276 fundage=. per_cash2=0.381
_ERROR_=1 _N_=77
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000012 summary_period2=A caldt=19941230 summary_period=A
nav_latest=14.3200000 nav_latest_dt=19941230 tna_latest=177.932 tna_latest_dt=19941230
yield=0.0275837989 div_ytd=0.39500000000 cap_gains_ytd=0.03900000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19950929 per_com=52
per_pref=0 per_conv=4 per_corp=4 per_muni=0 per_govt=19 per_oth=3 per_cash=0.18 per_bond=0
per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=0.0 maturity_dt=19950929 cusip8= 
crsp_portno=. crsp_cl_grp=. fund_name=AARP Growth Tr:Balanced Stock and Bond Fund ticker=ABSBX
ncusip=  mgmt_name=SCUDDER STEVENS & CLARK mgmt_cd=  mgr_name=Robert T Hoffman mgr_dt=19940201
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19940201 end_dt=20000731 dead_flag=Y
merge_fundno=028248 actual_12b1=0.000000 max_12b1=. mgmt_fee=. exp_ratio=0.010100
turn_ratio=0.637700 fiscal_yearend=. crsp_obj_cd=M si_obj_cd=BAL accrual_fund=  sales_restrict= 
wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name= 
lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=829 qd=280 fundage=.
per_cash2=0.37 _ERROR_=1 _N_=90
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000015 summary_period2=A caldt=19911231 summary_period=A
nav_latest=10.1700000 nav_latest_dt=19911231 tna_latest=5.750 tna_latest_dt=19911231 yield=.
div_ytd=0.00000000000 cap_gains_ytd=0.06000000000 nav_52w_h=. nav_52w_h_dt=. nav_52w_l=.
nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19911231 per_com=0 per_pref=0
per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=. per_mbs=.
per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=AMERICAN CAPITAL GLOBAL EQUITY FUND/A ticker=  ncusip=  mgmt_name=  mgmt_cd= 
mgr_name=  mgr_dt=19910801 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N
index_fund_flag=  vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19910101
end_dt=19980529 dead_flag=Y merge_fundno=031048 actual_12b1=. max_12b1=. mgmt_fee=.
exp_ratio=0.000000 turn_ratio=. fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=793
qd=268 fundage=. per_cash2=0 _ERROR_=1 _N_=121
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000016 summary_period2=A caldt=19911231 summary_period=A
nav_latest=10.2300000 nav_latest_dt=19911231 tna_latest=0.558 tna_latest_dt=19911231 yield=.
div_ytd=0.00000000000 cap_gains_ytd=0.06000000000 nav_52w_h=. nav_52w_h_dt=. nav_52w_l=.
nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19911231 per_com=0 per_pref=0
per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=. per_mbs=.
per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=AMERICAN CAPITAL GLOBAL EQUITY FUND/B ticker=  ncusip=  mgmt_name=  mgmt_cd= 
mgr_name=  mgr_dt=19911101 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N
index_fund_flag=  vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19910101
end_dt=19980529 dead_flag=Y merge_fundno=031046 actual_12b1=. max_12b1=. mgmt_fee=.
exp_ratio=0.000000 turn_ratio=. fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=793
qd=268 fundage=. per_cash2=0 _ERROR_=1 _N_=129
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000017 summary_period2=A caldt=19931231 summary_period=A
nav_latest=11.5500000 nav_latest_dt=19931231 tna_latest=2.570 tna_latest_dt=19931231 yield=.
div_ytd=0.00000000000 cap_gains_ytd=0.04250000000 nav_52w_h=. nav_52w_h_dt=. nav_52w_l=.
nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19940630 per_com=93 per_pref=0
per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0.07 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=0.0 maturity_dt=19940630 cusip8=  crsp_portno=.
crsp_cl_grp=. fund_name=American Capital World:Global Equity Fund/C ticker=ACGCX ncusip= 
mgmt_name=AMERICAN CAPITAL ASSET MANAGEMENT mgmt_cd=  mgr_name=Jeff New mgr_dt=19940401
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19930101 end_dt=19980529 dead_flag=Y
merge_fundno=031045 actual_12b1=0.010000 max_12b1=. mgmt_fee=. exp_ratio=0.032100
turn_ratio=1.160000 fiscal_yearend=. crsp_obj_cd=EFYG si_obj_cd=EGG accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=817
qd=276 fundage=. per_cash2=0.07 _ERROR_=1 _N_=137
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000018 summary_period2=A caldt=19761231 summary_period=A
nav_latest=24.5800000 nav_latest_dt=19761231 tna_latest=11.100 tna_latest_dt=19761231 yield=.
div_ytd=0.00000000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=. nav_52w_l=.
nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19761231 per_com=0 per_pref=0
per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=. per_mbs=.
per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=American General Muni Bond Fund ticker=ACMBX ncusip=  mgmt_name=  mgmt_cd=  mgr_name= 
mgr_dt=19880101 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag= 
vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19760101 end_dt=19950831 dead_flag=Y
merge_fundno=030948 actual_12b1=. max_12b1=. mgmt_fee=. exp_ratio=0.000000 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=Bonds lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name= 
lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=613 qd=208 fundage=.
per_cash2=0 _ERROR_=1 _N_=143
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000019 summary_period2=A caldt=19921231 summary_period=A
nav_latest=10.0200000 nav_latest_dt=19921231 tna_latest=3.773 tna_latest_dt=19921231
yield=0.0185628743 div_ytd=0.18600000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19930331 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=95 per_govt=0 per_oth=0 per_cash=0.05 per_bond=0
per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=21.3 maturity_dt=19930331 cusip8= 
crsp_portno=. crsp_cl_grp=. fund_name=AMERICAN CAPITAL MUNICIPAL BOND FUND/B ticker=  ncusip= 
mgmt_name=AMERICAN CAPITAL ASSET MANAGEMENT mgmt_cd=  mgr_name=ROBERT EVANS mgr_dt=19920901
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19920101 end_dt=19950831 dead_flag=Y
merge_fundno=030949 actual_12b1=0.010000 max_12b1=. mgmt_fee=. exp_ratio=0.017100 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=IU si_obj_cd=MGN accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=805 qd=272 fundage=. per_cash2=1
_ERROR_=1 _N_=163
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000020 summary_period2=A caldt=19931231 summary_period=A
nav_latest=10.5200000 nav_latest_dt=19931231 tna_latest=4.137 tna_latest_dt=19931231
yield=0.0199619772 div_ytd=0.21000000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19931231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=American Capital Municipal Bond Fund/C ticker=  ncusip=  mgmt_name=  mgmt_cd= 
mgr_name=  mgr_dt=19950401 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N
index_fund_flag=  vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19930101
end_dt=19950831 dead_flag=Y merge_fundno=030950 actual_12b1=. max_12b1=. mgmt_fee=.
exp_ratio=0.000000 turn_ratio=. fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=817
qd=276 fundage=. per_cash2=0 _ERROR_=1 _N_=167
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000021 summary_period2=A caldt=19901231 summary_period=A
nav_latest=9.9800000 nav_latest_dt=19901231 tna_latest=15.582 tna_latest_dt=19901231
yield=0.0095190381 div_ytd=0.09500000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19901231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=AMERICAN CAPITAL GOVERNMENT TGT SRS-PORT '97 ticker=  ncusip=  mgmt_name=  mgmt_cd= 
mgr_name=  mgr_dt=19900901 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N
index_fund_flag=  vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19900101
end_dt=19971128 dead_flag=Y merge_fundno=. actual_12b1=. max_12b1=. mgmt_fee=. exp_ratio=0.000000
turn_ratio=. fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund=  sales_restrict= 
wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name= 
lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=781 qd=264 fundage=.
per_cash2=0 _ERROR_=1 _N_=170
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000022 summary_period2=A caldt=19911231 summary_period=A
nav_latest=10.7600000 nav_latest_dt=19911231 tna_latest=8.795 tna_latest_dt=19911231
yield=0.0269516729 div_ytd=0.29000000000 cap_gains_ytd=0.04250000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19911231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=AMERICAN CAPITAL GOVERNMENT TGT SRS-PORT '98 ticker=  ncusip=  mgmt_name=  mgmt_cd= 
mgr_name=  mgr_dt=19910101 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N
index_fund_flag=  vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19910101
end_dt=19930331 dead_flag=Y merge_fundno=006281 actual_12b1=. max_12b1=. mgmt_fee=.
exp_ratio=0.000000 turn_ratio=. fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=793
qd=268 fundage=. per_cash2=0 _ERROR_=1 _N_=178
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000024 summary_period2=A caldt=19901231 summary_period=A
nav_latest=9.9000000 nav_latest_dt=19901231 tna_latest=26.050 tna_latest_dt=19901231
yield=0.0001010101 div_ytd=0.00100000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19901231 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=.
per_mbs=. per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=Axe-Core Int'l ADR Fund ticker=  ncusip=  mgmt_name=  mgmt_cd=  mgr_name= 
mgr_dt=19901101 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag= 
vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19900101 end_dt=19920630 dead_flag=Y
merge_fundno=. actual_12b1=. max_12b1=. mgmt_fee=. exp_ratio=0.000000 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=781 qd=264 fundage=. per_cash2=0
_ERROR_=1 _N_=182
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000025 summary_period2=A caldt=19921231 summary_period=A
nav_latest=17.6200000 nav_latest_dt=19921231 tna_latest=0.285 tna_latest_dt=19921231 yield=.
div_ytd=0.00000000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=. nav_52w_l=.
nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19921231 per_com=0 per_pref=0
per_conv=0 per_corp=0 per_muni=0 per_govt=0 per_oth=0 per_cash=0 per_bond=0 per_abs=. per_mbs=.
per_eq_oth=. per_fi_oth=. maturity=. maturity_dt=. cusip8=  crsp_portno=. crsp_cl_grp=.
fund_name=Ambassador Funds:Established Co Gr/Retail A ticker=  ncusip=  mgmt_name=  mgmt_cd= 
mgr_name=  mgr_dt=19930501 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N
index_fund_flag=  vau_fund=N et_flag=  delist_cd=  header=0 first_offer_dt=19920101
end_dt=19950531 dead_flag=Y merge_fundno=021286 actual_12b1=. max_12b1=. mgmt_fee=.
exp_ratio=0.000000 turn_ratio=. fiscal_yearend=. crsp_obj_cd=  si_obj_cd=  accrual_fund= 
sales_restrict=  wbrger_obj_cd=  policy=  lipper_class=  lipper_class_name=  lipper_obj_cd= 
lipper_obj_name=  lipper_asset_cd=  lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=805
qd=272 fundage=. per_cash2=0 _ERROR_=1 _N_=185
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
in1=0 wficn=. crsp_fundno=000026 summary_period2=A caldt=19951229 summary_period=A
nav_latest=10.2100000 nav_latest_dt=19951229 tna_latest=0.202 tna_latest_dt=19951229
yield=0.0266405485 div_ytd=0.27200000000 cap_gains_ytd=0.05100000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19960329 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=97.4 per_govt=0 per_oth=0 per_cash=0.026 per_bond=0
per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=0.0 maturity_dt=19960329 cusip8= 
crsp_portno=. crsp_cl_grp=. fund_name=Achievement Fds Trust:Short Term Muni/Retail ticker= 
ncusip=  mgmt_name=SEI FINANCIAL MANAGEMENT CORP. mgmt_cd=  mgr_name=James A Schuck
mgr_dt=19950301 adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag= 
vau_fund=N et_flag=  delist_cd=L header=1 first_offer_dt=19950101 end_dt=19990331 dead_flag=Y
merge_fundno=. actual_12b1=0.002500 max_12b1=. mgmt_fee=. exp_ratio=0.010000 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=IUS si_obj_cd=MSM accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=0 LAST.crsp_fundno=0 md=841 qd=284 fundage=. per_cash2=1
_ERROR_=1 _N_=190
NOTE: Invalid argument to function LOG(0) at line 1110 column 15.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.
in1=0 wficn=. crsp_fundno=000028 summary_period2=A caldt=19921231 summary_period=A
nav_latest=11.3500000 nav_latest_dt=19921231 tna_latest=11.986 tna_latest_dt=19921231
yield=0.0220264317 div_ytd=0.25000000000 cap_gains_ytd=0.00000000000 nav_52w_h=. nav_52w_h_dt=.
nav_52w_l=. nav_52w_l_dt=. unrealized_app_dep=. unrealized_app_dt=. asset_dt=19930331 per_com=0
per_pref=0 per_conv=0 per_corp=0 per_muni=90 per_govt=0 per_oth=0 per_cash=0.1 per_bond=0
per_abs=. per_mbs=. per_eq_oth=. per_fi_oth=. maturity=19.6 maturity_dt=19930331 cusip8= 
crsp_portno=. crsp_cl_grp=. fund_name=AMERICAN CAPITAL TXEX TRUST-INSURED MUNI/B ticker=ACTJX
ncusip=  mgmt_name=AMERICAN CAPITAL ASSET MANAGEMENT mgmt_cd=  mgr_name=BOB EVANS mgr_dt=19920701
adv_name=  open_to_inv=  retail_fund=  inst_fund=  m_fund=N index_fund_flag=  vau_fund=N
et_flag=  delist_cd=  header=0 first_offer_dt=19920101 end_dt=19950831 dead_flag=Y
merge_fundno=030993 actual_12b1=0.010000 max_12b1=. mgmt_fee=. exp_ratio=0.018200 turn_ratio=.
fiscal_yearend=. crsp_obj_cd=IU si_obj_cd=MIS accrual_fund=  sales_restrict=  wbrger_obj_cd= 
policy=  lipper_class=  lipper_class_name=  lipper_obj_cd=  lipper_obj_name=  lipper_asset_cd= 
lipper_tax_cd=  FIRST.crsp_fundno=1 LAST.crsp_fundno=0 md=805 qd=272 fundage=. per_cash2=1
_ERROR_=1 _N_=206
NOTE: MERGE statement has more than one data set with repeats of BY values.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      24030 at 1110:15    24030 at 1110:31    24030 at 1110:33    453554 at 1111:17
      453554 at 1111:51   453554 at 1112:24   
NOTE: Mathematical operations could not be performed at the following places. The results of the 
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      122997 at 1110:15   
NOTE: There were 1684 observations read from the data set WORK.MF_PORT.
NOTE: There were 2500116 observations read from the data set DATA.FUND_SUMMARY2.
NOTE: The data set WORK.FUNDCHARS has 73530 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           0.82 seconds
      cpu time            0.79 seconds
      

1118  proc sort data=fundchars; by wficn date; run;

NOTE: There were 73530 observations read from the data set WORK.FUNDCHARS.
NOTE: The data set WORK.FUNDCHARS has 73530 observations and 16 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1119  
1120  
1121  * Get hand-checked management name and code;
1122  proc import out      = std_mgmt_names
1123              datafile =
1123! 'C:/Users/hpham13/Projects/mf_activism/empirical/0_input/original/mff_names_dedup2023.xlsx'
1124              dbms     = xlsx
1125              replace;
1126  run;

NOTE: One or more variables were converted because the data type is not supported by the V9 
      engine. For more details, run with options MSGLEVEL=I.
NOTE: The import data set has 3132 observations and 7 variables.
NOTE: WORK.STD_MGMT_NAMES data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.10 seconds
      cpu time            0.12 seconds
      

1127  proc sort data=std_mgmt_names nodupkey; by mgmt_name ; run;

NOTE: There were 3132 observations read from the data set WORK.STD_MGMT_NAMES.
NOTE: 327 observations with duplicate key values were deleted.
NOTE: The data set WORK.STD_MGMT_NAMES has 2805 observations and 7 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1128  
1129  proc sql;
1130      create table fundchars as
1131      select a.*, b.corrected_mgmt_cd
1132      from fundchars as a left join std_mgmt_names as b
1133      on a.mgmt_name=b.mgmt_name ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.FUNDCHARS created, with 73530 rows and 17 columns.

1134  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

1135  
1136  * if corrected_mgmt_cd is missing, replace by original mgmt_cd and rename ;
1137  data fundchars; set fundchars;
1138      if missing(corrected_mgmt_cd) and not missing(mgmt_cd) then corrected_mgmt_cd = mgmt_cd
1138!  ;
1139      if missing(corrected_mgmt_cd) and missing(mgmt_cd) and not missing(mgmt_name) then
1139! corrected_mgmt_cd = mgmt_name ;
1140      drop mgmt_cd;
1141      label corrected_mgmt_cd="Management Company Code";
1142      rename corrected_mgmt_cd= mgmt_cd ;
1143  run;

NOTE: There were 73530 observations read from the data set WORK.FUNDCHARS.
NOTE: The data set WORK.FUNDCHARS has 73530 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1144  
1145  proc sql;
1146      create table returns_merged as
1147      select  a.*,
1148              b.crsp_fundno, b.fundage, b.turn_ratio, b.md, b.qd, b.mgmt_name, b.mgmt_cd,
1149              b.per_cash, b.per_muni, b.per_govt, b.per_cash2, (b.per_cash*a.tna) as mfcash,
1150              (b.per_cash2*a.tna) as mfcash2, b.nav_latest
1151      from    returns(where=(date between "&begdate"d and "&enddate"d)) as a left join
1151! fundchars as b
1152          on  a.wficn=b.wficn and a.qd=b.qd;
WARNING: Variable crsp_fundno already exists on file WORK.RETURNS_MERGED.
WARNING: Variable md already exists on file WORK.RETURNS_MERGED.
WARNING: Variable qd already exists on file WORK.RETURNS_MERGED.
NOTE: Table WORK.RETURNS_MERGED created, with 218602 rows and 21 columns.

1153  
1154      create view MF_merged2 as
1155      select  a.*, b.tna label='TNA ($millions)', b.exp_ratio, b.rret ,b.mgmt_name, b.mgmt_cd
1156      from    MF_merged as a left join (select wficn, md, qd, tna, exp_ratio, rret ,
1156! mgmt_name, mgmt_cd
1157              from returns_merged ) as b
1158      on      a.wficn=b.wficn and a.md=b.md ;
NOTE: SQL view WORK.MF_MERGED2 has been defined.
1159  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.15 seconds
      cpu time            0.15 seconds
      

1160  
1161  
1162  /* ******************************************************************************** */
1163  /* Part 5:   Compute ownership and define large holding families   **************** */
1164  /* ******************************************************************************** */
1165  proc sort
1166      data=MF_merged2 nodupkey
1167      out=MF_merged3 ;
1168      by   permno rdate wficn ;
1169  run;

NOTE: There were 26650378 observations read from the data set WORK.MF_MERGED2.
NOTE: 12132208 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED3 has 14518170 observations and 16 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           8.02 seconds
      cpu time            17.42 seconds
      

1170  
1171  
1172  data MF_merged3; set MF_merged3;
1173      if rdate ne . ;
1174      if not missing(mgmt_cd) ;
1175  run;

NOTE: There were 14518170 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 13661616 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           2.04 seconds
      cpu time            1.68 seconds
      

1176  
1177  proc sql;
1178      create table MF_merged3 as
1179      select *, sum(shares_adj) as shares_adj_mff
1180      from MF_merged3
1181      group permno, rdate, mgmt_cd   ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED3 created, with 13661616 rows and 17 columns.

1182  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           8.06 seconds
      cpu time            10.92 seconds
      

1183  
1184  proc sql;
1185      create table MF_merged3 as
1186      select *, count(distinct permno) as num_firms
1187      from MF_merged3
1188      group mgmt_cd , rdate ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED3 created, with 13661616 rows and 18 columns.

1189  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           7.72 seconds
      cpu time            12.17 seconds
      

1190  proc sort data=MF_merged3;
1191      by permno rdate mgmt_cd;
1192  run;

NOTE: There were 13661616 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 13661616 observations and 18 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           3.68 seconds
      cpu time            7.90 seconds
      

1193  
1194  * follow the literature, we exclude observations with TNA does not exceed $1mil and
1194! num_firms does not exceed 10. ;
1195  data MF_merged3;
1196      set MF_merged3;
1197      if tna > 1;
1198      if num_firms > 10;
1199  run;

NOTE: There were 13661616 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 13579066 observations and 18 variables.
NOTE: DATA statement used (Total process time):
      real time           1.87 seconds
      cpu time            1.87 seconds
      

1200  
1201  data MF_merged3; set MF_merged3;
1202      drop shares_adj exp_ratio rret  ;
1203  run;

NOTE: There were 13579066 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 13579066 observations and 15 variables.
NOTE: DATA statement used (Total process time):
      real time           2.15 seconds
      cpu time            1.76 seconds
      

1204  
1205  data MF_merged3; set MF_merged3;
1206      rename  shares_adj_mff=shares_adj;
1207      label shares_adj_mff = "Total shares at MFF";
1208  run;

NOTE: There were 13579066 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 13579066 observations and 15 variables.
NOTE: DATA statement used (Total process time):
      real time           1.75 seconds
      cpu time            1.62 seconds
      

1209  
1210  * Get TSO;
1211  data MF_merged3;
1212      merge MF_merged3(in=a) price (in=b rename=(qdate=rdate));
1213      by permno rdate;
1214      if b and TSO>0;
1215      MFOR = shares_adj/TSO;
1216      label MFOR = "MFOwn MFF-Firm-Level";
1217      format MFOR percentn8.4;
1218      format ME P_1 P comma8.4;
1219      if wficn ne . ;
1220  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      394546 at 1215:22   
NOTE: There were 13579066 observations read from the data set WORK.MF_MERGED3.
NOTE: There were 788968 observations read from the data set WORK.PRICE.
NOTE: The data set WORK.MF_MERGED3 has 11366172 observations and 22 variables.
NOTE: DATA statement used (Total process time):
      real time           2.34 seconds
      cpu time            2.32 seconds
      

1221  
1222  
1223  * Compute the firm weight in a mutual fund portfolio at the mutual fund - quarter level;
1224  proc sql;
1225      create table MF_merged3 as
1226      select *, (shares_adj*P)/sum(shares_adj*P) as fweight label="Firm weight" format
1226! percentn8.4
1227      from MF_merged3
1228      group by mgmt_cd, rdate
1229      order by mgmt_cd, rdate, permno;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED3 created, with 11366172 rows and 23 columns.

1230  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           8.64 seconds
      cpu time            15.23 seconds
      

1231  
1232  data MF_merged3; set MF_merged3;
1233      drop wficn fundno crsp_fundno;
1234      if not missing(mgmt_cd) ;
1235      ryear = year(rdate);
1236  run;

NOTE: There were 11366172 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 11366172 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           1.98 seconds
      cpu time            1.82 seconds
      

1237  
1238  * require at least 2 obs;
1239  proc sql;
1240      create table MF_merged3 as
1241      select * from MF_merged3
1242      group by mgmt_cd, permno
1243      having count(*) >=2 ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED3 created, with 11309228 rows and 21 columns.

1244  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           6.15 seconds
      cpu time            8.74 seconds
      

1245  
1246  
1247  * Compute the change of ownership and change of Firm weight;
1248  proc sort data= MF_merged3; by mgmt_cd permno rdate; run;

NOTE: There were 11309228 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 11309228 observations and 21 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           2.86 seconds
      cpu time            6.01 seconds
      

1249  data MF_merged3; set MF_merged3;
1250      by mgmt_cd permno ;
1251      MFOR_l = lag(MFOR);
1252      fweight_l = lag(fweight);
1253      if first.permno then MFOR_l=.;
1254      if first.permno then fweight_l=.;
1255      changefweight = fweight - fweight_l ;
1256      changeMFOR = MFOR - MFOR_l ;
1257      /*assume no change for the first obs*/
1258      if first.permno then changefweight = 0 ;
1259      if first.permno then changeMFOR = 0 ;
1260      if first.permno then delete;
1261      drop MFOR_l fweight_l ;
1262      format fweight changefweight MFOR changeMFOR percentn8.4;
1263  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      411086 at 1255:29   408521 at 1256:23   
NOTE: There were 11309228 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3 has 10900707 observations and 23 variables.
NOTE: DATA statement used (Total process time):
      real time           2.02 seconds
      cpu time            2.01 seconds
      

1264  
1265  
1266  * ************************************************
1267  *  make an indicator for large holding (>=1%);
1268  * ************************************************;
1269  data MF_merged3_1;
1270      set MF_merged3;
1271      MFORpct = round(MFOR*100, 0.01);
1272      if MFORpct >= 1 then LargeMF = 1; else LargeMF = 0;
1273  run;

NOTE: There were 10900707 observations read from the data set WORK.MF_MERGED3.
NOTE: The data set WORK.MF_MERGED3_1 has 10900707 observations and 25 variables.
NOTE: DATA statement used (Total process time):
      real time           1.71 seconds
      cpu time            1.60 seconds
      

1274  
1275  proc sql;
1276      create table MF_merged3_1 as
1277      select *, max(LargeMF) as LargeMF2 label="Have LargeMF"
1278      from  MF_merged3_1
1279      where shares_adj > 0
1280      group by permno, rdate
1281      having LargeMF2=1
1282      order by permno, rdate, mgmt_cd;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED3_1 created, with 9558771 rows and 26 columns.

1283  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           9.28 seconds
      cpu time            14.43 seconds
      

1284  
1285  
1286  /* ******************************************************************************** */
1287  /* Part 6:  Get identifers and date from Compustat  ******************************* */
1288  /* ******************************************************************************** */
1289  %let begdate = 01MAR1995;
1290  %let enddate = 31DEC2021;
1291  %let vars=  gvkey fyearq fqtr fyr rdq conm datadate indfmt datafmt popsrc consol saleq atq;
1292  
1293  data fundq;
1294     set comp.fundq_1950_2021 (keep= &vars);
1295     where datadate between "&begdate"d and "&enddate"d ;
1296     if indfmt='INDL' and datafmt='STD' and popsrc='D' and consol='C';
1297     format endfyr begfyr date9.;
1298     endfyr= datadate;
1299     begfyr= intnx('month',endfyr,-11,'beg');
1300     if atq>0;
1301     if saleq>0;
1302  run;

NOTE: There were 1240531 observations read from the data set COMP.FUNDQ_1950_2021.
      WHERE (datadate>='01MAR1995'D and datadate<='31DEC2021'D);
NOTE: The data set WORK.FUNDQ has 861686 observations and 15 variables.
NOTE: DATA statement used (Total process time):
      real time           3.95 seconds
      cpu time            0.40 seconds
      

1303  proc sort; by gvkey endfyr; run;

NOTE: There were 861686 observations read from the data set WORK.FUNDQ.
NOTE: The data set WORK.FUNDQ has 861686 observations and 15 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.14 seconds
      cpu time            0.32 seconds
      

1304  
1305  * Make a link GVKEYS to CRSP-PERMNO;
1306  proc sql;
1307    create table comp_lnk as select *
1308    from fundq as a, lnk.ccmxpf_lnkhist as b
1309    where a.gvkey = b.gvkey and
1310    b.LINKTYPE in ("LU","LC","LD","LN","LS","LX") and
1311    (b.LINKDT <= a.endfyr or b.LINKDT = .B) and (a.endfyr <= b.LINKENDDT or b.LINKENDDT = .E)
1311! ;
WARNING: Variable GVKEY already exists on file WORK.COMP_LNK.
NOTE: Table WORK.COMP_LNK created, with 624470 rows and 22 columns.

1312  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.15 seconds
      cpu time            0.12 seconds
      

1313  
1314  
1315  /* ******************************************************************************** */
1316  /* Part 7: Make the InformedTradeGrap variable  *********************************** */
1317  /* ******************************************************************************** */
1318  proc sql;
1319      create view MF_merged_comp1 as
1320      select a.gvkey, a.datadate, a.rdq, b.*
1321      from comp_lnk as a join MF_merged3_1 as b
1322      on a.lpermno=b.permno and
1323         year(a.datadate)=year(b.rdate) and qtr(a.datadate)=qtr(b.rdate);
NOTE: SQL view WORK.MF_MERGED_COMP1 has been defined.
1323!                                                                         * SEE MY NOTE
1323! ABOVE, WHY WE USE 'datadate';
1324  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1325  
1326  proc sort
1327      data=MF_merged_comp1
1328      out=MF_merged_comp nodupkey ;
1329      by permno rdate mgmt_cd ;
1330  run;

NOTE: There were 9510488 observations read from the data set WORK.MF_MERGED_COMP1.
NOTE: 5127718 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED_COMP has 4382770 observations and 29 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           4.32 seconds
      cpu time            6.21 seconds
      

1331  
1332  * read the abnormal return data;
1333  data abret_car;
1334      set rawdata.abret013024_capm;   * use CAPM model;
1335  run;

NOTE: There were 816855 observations read from the data set RAWDATA.ABRET013024_CAPM.
NOTE: The data set WORK.ABRET_CAR has 816855 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.31 seconds
      cpu time            0.04 seconds
      

1336  proc sort data=abret_car nodupkey; by gvkey rdq; run;

NOTE: There were 816855 observations read from the data set WORK.ABRET_CAR.
NOTE: 9675 observations with duplicate key values were deleted.
NOTE: The data set WORK.ABRET_CAR has 807180 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.10 seconds
      cpu time            0.28 seconds
      

1337  
1338  
1339  * lead abnormal returns by 1 quarter;
1340  proc expand data = abret_car out=abret_car method=none ;
1341      by gvkey ;
1342      id rdq;
1343      convert abret = abret_lead / transformout = (lead 1);
1344      convert car   = car_lead / transformout = (lead 1);
1345  run;

NOTE: The data set WORK.ABRET_CAR has 807180 observations and 11 variables.
NOTE: PROCEDURE EXPAND used (Total process time):
      real time           0.80 seconds
      cpu time            0.76 seconds
      

1346  
1347  data abret_car;
1348      set abret_car;
1349      label abret_lead="Abret t+1";
1350      label car_lead="CAR[-1,1] t+1";
1351  run;

NOTE: There were 807180 observations read from the data set WORK.ABRET_CAR.
NOTE: The data set WORK.ABRET_CAR has 807180 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.04 seconds
      

1352  
1353  * merge Abnormal returns to MFF data;
1354  proc sql;
1355      create table MF_merged_comp as
1356      select a.*, b.car, b.abret, b.car_lead, b.abret_lead, b.logret, b.fyear
1357      from MF_merged_comp as a join abret_car as b
1358      on a.gvkey=b.gvkey and a.rdq=b.rdq;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED_COMP created, with 4303334 rows and 35 columns.

1359  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.60 seconds
      cpu time            1.54 seconds
      

1360  
1361  data MF_merged_comp;
1362      set MF_merged_comp;
1363      format car abret car_lead abret_lead comma8.5;
1364      stkpick1 = (changeMFOR * 100)    * (car_lead * 100);
1365      stkpick2 = (changefweight * 100) * (car_lead * 100);
1366      if stkpick1 ne .;
1367  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      51007 at 1364:50   94 at 1365:31      51005 at 1365:50   
NOTE: There were 4303334 observations read from the data set WORK.MF_MERGED_COMP.
NOTE: The data set WORK.MF_MERGED_COMP has 4252327 observations and 37 variables.
NOTE: DATA statement used (Total process time):
      real time           0.83 seconds
      cpu time            0.82 seconds
      

1368  
1369  proc sql;
1370      create table MF_merged_comp2 as
1371      select   *
1372               ,avg(stkpick1) as avg_stkpick1_all
1373               ,avg(stkpick2) as avg_stkpick2_all
1374      from     MF_merged_comp
1375      group by permno, rdate
1376      order by permno, rdate, LargeMF ;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.MF_MERGED_COMP2 created, with 4252327 rows and 39 columns.

1377  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.89 seconds
      cpu time            6.50 seconds
      

1378  
1379  proc sql;
1380      create table MF_merged_comp2_1 as
1381      select   gvkey, datadate, rdq, car_lead, car
1382               ,permno, rdate, md, qd, LargeMF, mgmt_cd, MFOR
1383               ,stkpick1
1384               ,stkpick2
1385               ,avg_stkpick1_all
1386               ,avg_stkpick2_all
1387      from     MF_merged_comp2 ;
NOTE: Table WORK.MF_MERGED_COMP2_1 created, with 4252327 rows and 16 columns.

1388  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.67 seconds
      cpu time            0.56 seconds
      

1389  
1390  proc sql;
1391      create table MF_merged_comp2_2 as
1392      select   *
1393               ,avg(stkpick1) as avg_stkpick1
1394               ,avg(stkpick2) as avg_stkpick2
1395               ,count(mgmt_cd) as NumInst
1396               ,avg(MFOR)     as avgMFOR
1397               ,sum(MFOR)     as sumMFOR
1398      from     MF_merged_comp2_1
1399      group by permno, rdate, LargeMF
1400      order by permno, rdate, LargeMF;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.MF_MERGED_COMP2_2 created, with 4252327 rows and 21 columns.

1401  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.14 seconds
      cpu time            1.09 seconds
      

1402  
1403  data MF_merged_comp2_2; set MF_merged_comp2_2;
1404      if LargeMF=1 then _stkpick1_Large = avg_stkpick1;
1405      if LargeMF=0 then _stkpick1_Small = avg_stkpick1;
1406  run;

NOTE: There were 4252327 observations read from the data set WORK.MF_MERGED_COMP2_2.
NOTE: The data set WORK.MF_MERGED_COMP2_2 has 4252327 observations and 23 variables.
NOTE: DATA statement used (Total process time):
      real time           0.46 seconds
      cpu time            0.46 seconds
      

1407  
1408  proc sql;
1409      create table MF_merged_comp2_3 as
1410      select *
1411             , max(_stkpick1_Large) as stkpick1_Large
1412             , max(_stkpick1_Small) as stkpick1_Small
1413      from MF_merged_comp2_2
1414      group by permno, rdate
1415      order by permno, rdate, LargeMF;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.MF_MERGED_COMP2_3 created, with 4252327 rows and 25 columns.

1416  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.84 seconds
      cpu time            3.34 seconds
      

1417  data MF_merged_comp2_3; set MF_merged_comp2_3;
1418      drop _stkpick1_Large _stkpick1_Small;
1419      year = year(rdate);
1420  run;

NOTE: There were 4252327 observations read from the data set WORK.MF_MERGED_COMP2_3.
NOTE: The data set WORK.MF_MERGED_COMP2_3 has 4252327 observations and 24 variables.
NOTE: DATA statement used (Total process time):
      real time           0.57 seconds
      cpu time            0.56 seconds
      

1421  
1422  * treat outliers;
1423  %let winsVars = avg_stkpick1 avg_stkpick2 avg_stkpick1_all stkpick1_Large stkpick1_Small;
1424  %winsor(
1425      dsetin  = work.MF_merged_comp2_3,
1426      dsetout = work.MF_merged_comp2_3,
1427      byvar   = year,
1428      vars    = &winsVars,
1429      type    = winsor,
1430      pctl    = 1 99
1431  );

NOTE: There were 4252327 observations read from the data set WORK.MF_MERGED_COMP2_3.
NOTE: The data set WORK.XTEMP has 4252327 observations and 24 variables.
NOTE: DATA statement used (Total process time):
      real time           0.43 seconds
      cpu time            0.43 seconds
      


NOTE: There were 4252327 observations read from the data set WORK.XTEMP.
NOTE: The data set WORK.XTEMP has 4252327 observations and 24 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.65 seconds
      cpu time            1.29 seconds
      


NOTE: The data set WORK.XTEMP_PCTL has 26 observations and 11 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           5.04 seconds
      cpu time            4.96 seconds
      


WARNING: The variable xbyvar in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 4252327 observations read from the data set WORK.XTEMP.
NOTE: There were 26 observations read from the data set WORK.XTEMP_PCTL.
NOTE: The data set WORK.MF_MERGED_COMP2_3 has 4252327 observations and 24 variables.
NOTE: DATA statement used (Total process time):
      real time           0.75 seconds
      cpu time            0.73 seconds
      

1432  proc sql;
1433      drop table xtemp, xtemp_pctl;
NOTE: Table WORK.XTEMP has been dropped.
NOTE: Table WORK.XTEMP_PCTL has been dropped.
1434  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

1435  
1436  * we compute the difference between LargeMF(=1) and smallMF (=0);
1437  proc sort data=MF_merged_comp2_3 nodupkey; by permno rdate LargeMF ; run;

NOTE: There were 4252327 observations read from the data set WORK.MF_MERGED_COMP2_3.
NOTE: 3852154 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED_COMP2_3 has 400173 observations and 24 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.54 seconds
      cpu time            1.04 seconds
      

1438  data MF_merged_comp2_3;
1439      set MF_merged_comp2_3;
1440      by permno rdate;
1441      Relstkpick1 = dif(avg_stkpick1);
1442      if first.permno or first.rdate then Relstkpick1 = .;
1443  run;

NOTE: There were 400173 observations read from the data set WORK.MF_MERGED_COMP2_3.
NOTE: The data set WORK.MF_MERGED_COMP2_3 has 400173 observations and 25 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.06 seconds
      

1444  
1445  proc sort data=MF_merged_comp2_3 nodupkey; by permno rdate LargeMF ; run;

NOTE: There were 400173 observations read from the data set WORK.MF_MERGED_COMP2_3.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED_COMP2_3 has 400173 observations and 25 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.08 seconds
      cpu time            0.15 seconds
      

1446  data MF_merged_comp2_4;
1447      set MF_merged_comp2_3;
1448      by permno rdate;
1449      Relstkpick2 = dif(avg_stkpick2);
1450      if first.permno or first.rdate then Relstkpick2 = .;
1451  run;

NOTE: There were 400173 observations read from the data set WORK.MF_MERGED_COMP2_3.
NOTE: The data set WORK.MF_MERGED_COMP2_4 has 400173 observations and 26 variables.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.04 seconds
      

1452  
1453  proc sort data=MF_merged_comp2_4 nodupkey; by permno rdate  LargeMF ; run;

NOTE: There were 400173 observations read from the data set WORK.MF_MERGED_COMP2_4.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED_COMP2_4 has 400173 observations and 26 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.08 seconds
      cpu time            0.15 seconds
      

1454  data MF_merged_comp2_4; set MF_merged_comp2_4;
1455      if LargeMF = 0 then _avgMFORsmall = avgMFOR; else _avgMFORsmall = 0 ;
1456      if LargeMF = 1 then _avgMFORlarge = avgMFOR; else _avgMFORlarge = 0 ;
1457      if LargeMF = 0 then _sumMFORsmall = sumMFOR; else _sumMFORsmall = 0 ;
1458      if LargeMF = 1 then _sumMFORlarge = sumMFOR; else _sumMFORlarge = 0 ;
1459      if LargeMF = 0 then _NumInstsmall = NumInst; else _NumInstsmall = 0 ;
1460      if LargeMF = 1 then _NumInstlarge = NumInst; else _NumInstlarge = 0 ;
1461  run;

NOTE: There were 400173 observations read from the data set WORK.MF_MERGED_COMP2_4.
NOTE: The data set WORK.MF_MERGED_COMP2_4 has 400173 observations and 32 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.06 seconds
      

1462  
1463  * collapse data to the firm-quarter ;
1464  proc sql;
1465      create table MF_merged_comp2_4 as
1466      select *, max(_avgMFORsmall) as avgMFORsmall label="Avg of MFFOwn (small)",
1467                max(_avgMFORlarge) as avgMFORlarge label="Avg of MFFOwn (large)",
1468                max(_sumMFORsmall) as sumMFORsmall label="Sum of MFFOwn (small)",
1469                max(_sumMFORlarge) as sumMFORlarge label="Sum of MFFOwn (large)",
1470                max(_NumInstsmall) as NumInstsmall label="Number of MFF (small)",
1471                max(_NumInstlarge) as NumInstlarge label="Number of MFF (large)"
1472      from MF_merged_comp2_4
1473      group by permno, rdate;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.MF_MERGED_COMP2_4 created, with 400173 rows and 38 columns.

1474  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.26 seconds
      cpu time            0.29 seconds
      

1475  
1476  data MF_merged_comp3; set MF_merged_comp2_4;
1477      drop avg_stkpick1 avg_stkpick2 LargeMF;
1478      if Relstkpick2 eq . then delete;
1479      ryear = year(rdate);
1480      format avgMFORsmall avgMFORlarge sumMFORsmall sumMFORlarge percent8.2;
1481      drop _avgMFORsmall _avgMFORlarge _sumMFORsmall _sumMFORlarge
1482          _NumInstsmall _NumInstlarge NumInst mgmt_cd avgMFOR sumMFOR;
1483  run;

NOTE: There were 400173 observations read from the data set WORK.MF_MERGED_COMP2_4.
NOTE: The data set WORK.MF_MERGED_COMP3 has 197584 observations and 26 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

1484  
1485  proc sort data=MF_merged_comp3 nodupkey; by permno rdate; run;

NOTE: There were 197584 observations read from the data set WORK.MF_MERGED_COMP3.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.MF_MERGED_COMP3 has 197584 observations and 26 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.05 seconds
      cpu time            0.04 seconds
      

1486  
1487  proc sort data=MF_merged_comp3; by permno qd md; run;

NOTE: There were 197584 observations read from the data set WORK.MF_MERGED_COMP3.
NOTE: The data set WORK.MF_MERGED_COMP3 has 197584 observations and 26 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.05 seconds
      cpu time            0.09 seconds
      

1488  data MF_merged_comp4;
1489      retain gvkey datadate rdq permno rdate ryear;
1490      set MF_merged_comp3;
1491      by permno qd md;
1492      if last.qd;
1493  run;

NOTE: There were 197584 observations read from the data set WORK.MF_MERGED_COMP3.
NOTE: The data set WORK.MF_MERGED_COMP4 has 197584 observations and 26 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1494  
1495  data MF_merged_comp4;
1496      set MF_merged_comp4;
1497      label avg_stkpick1_all = "InformedTrade All"
1498            stkpick1_Large   = "InformedTrade LH"
1499            stkpick1_Small   = "InformedTrade SH"
1500            Relstkpick1      = "InformedTradeGrap"
1501            Relstkpick2      = "InformedTradeGrap2";
1502  run;

NOTE: There were 197584 observations read from the data set WORK.MF_MERGED_COMP4.
NOTE: The data set WORK.MF_MERGED_COMP4 has 197584 observations and 26 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1503  
1504  /* delete unneeded datasets */
1505  proc datasets nowarn nolist nodetails;
1506      delete MF_merged_comp
1507             MF_merged_comp1
1508             MF_merged_comp2
1509             MF_merged_comp3
1510             abret_car
1511             MFO_Metrics_comp
1512             MFO_TimeSeries_comp
1513             MFO_Metrics3
1514             MFO_TimeSeries3;
1515  run;

NOTE: Deleting WORK.MF_MERGED_COMP (memtype=DATA).
NOTE: Deleting WORK.MF_MERGED_COMP2 (memtype=DATA).
NOTE: Deleting WORK.MF_MERGED_COMP3 (memtype=DATA).
NOTE: Deleting WORK.ABRET_CAR (memtype=DATA).
1516  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.21 seconds
      cpu time            0.21 seconds
      

1517  
1518  data save.stkpick111624_idx;
1519      set MF_merged_comp4;
1520  run;

NOTE: There were 197584 observations read from the data set WORK.MF_MERGED_COMP4.
NOTE: The data set SAVE.STKPICK111624_IDX has 197584 observations and 26 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1521  
1522  proc printto;
1523  run;

